<div class="modal fade bs-modal-lg" id="modelContent">
	<div class="modal-dialog modal-lg">
        <div class="modal-content"></div>
    </div>
</div> 

<div class="portlet box green">
    <div class="portlet-title">
		<div class="caption"><i class="fa fa-cogs"></i>订单 &gt; 服务管理 &gt; 维保服务管理</div>
		<div class="tools"><a href="javascript:;" class="collapse" data-original-title="" title=""> </a></div>
    </div>
    <div style="background-color: rgb(249, 247, 161);">
		<label >
	</label>
	</div>
    <div class="portlet-body">
    	<div class="tabbable-line ">
			<ul class="nav nav-tabs ">
				<li>
					<a href="/service/list?currentstate=1" class="ajaxify" >已处理</a>
					
				</li> 
				<li>
					<a href="/service/list?currentstate=0" class="ajaxify">未处理</a>
				</li> 
			</ul>
			<div class="tab-content">
				<div class="tab-pane active form">
				</div>
			</div>
		</div>
		<div class="portlet-body form">
		   	<form action="/service/list" class="form-horizontal" method="get" id="searchForm" onsubmit="return false">
				<div class="form-body">
					<div class="row">
						<div class="col-md-3">
							<label class="col-md-4 control-label">单号：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="id" value="$!searchModel.id">
							</div>
						</div>
						<div class="col-md-3">
							<label class="col-md-4 control-label">会员：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="userName" value="$!searchModel.username">
							</div>
						</div>
						<div class="col-md-3">
							<label class="col-md-4 control-label">维保人：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="realName" value="$!searchModel.username">
							</div>
						</div>
		    		</div>
		    		<div class="row">
		    		&nbsp;<br/>
		    		</div>
		    		<div class="row">
						<div class="col-md-3">
							<label class="col-md-4 control-label">所属企业：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="company" value="$!searchModel.company">
							</div>
						</div>
						<div class="col-md-4">
							<label class="col-md-3 control-label">申请时间：</label>
							<div class="col-md-4">
						    	<input type="text" class="form-control" readOnly id="startTime" name="startTime" value="$!startTime">
						    	<i class="fa fa-calendar" style="position: absolute;right: 10px;top: 10px"></i>
							</div>
							<div class="col-md-1">~</div>
							<div class="col-md-4">
						    	<input type="text" class="form-control"readOnly id="endTime" name="endTime" value="$!endTime">
						    	<i class="fa fa-calendar" style="position: absolute;right: 10px;top: 10px"></i>
							</div>
						</div>
						<div class="col-md-2">
							<div class="actions col-md-12">
								<a href="javascript:;" class="btn green btn-sm ajax-search"><i class="fa fa-search"></i>查询 </a>
								<a href="javascript:;" class="btn green btn-sm search-reset"><i class="fa fa-eraser"></i> 清除 </a>
							</div>
						</div>
						<br>
		      	<div class="btn-group " >
					<button type="button" class="btn white btn-sm delete-tab" data-toggle="dropdown"> 
						<i class="fa fa-cloud-download"></i> 导出
					</button>
					<ul class="dropdown-menu pull-right" role="menu">
						<li>
							<a href="javascript:;" class="export-tab"> <i class="fa fa-cube"></i> 指定商品</a>
						</li>
						<li>
							<a href="javascript:;" class="export-all"> <i class="fa fa-cubes"></i> 全部商品</a>
						</li>
					</ul>
			  </div>
		    		</div>
				</div>
				
			</form>
		</div>
		 
		    <div class="portlet-title">
		<div class="caption"><i class="fa fa-cogs"></i>数据列表</div>
					<div class="tools"><a href="javascript:;" class="collapse" data-original-title="" title=""> </a></div>
			   		<div class="actions">
			   			<a href="javascript:;"   class="btn white btn-sm delete-tabb" ><i class="fa fa-trash"></i>删除</a>
			   		</div>	
       </div>
       
    	<div class="dataTables_wrapper no-footer">
			<div class="table-scrollable">
			    <table class="table table-striped table-bordered table-hover">
				  	<thead>
						<tr>
						<th style="width: 20px">
						   <input type="checkbox" class="icheck group-icheck" />
					   </th>
		   		 			<th>维保订单</th>
		   		 			<th>状态</th>
		   		 			<th>维保项目</th>
		   		 			<th>维保会员</th>
		   		 			<th>维保联系人</th>
		   		 			<th>维保电话</th>
		   		 			<th>预约时间</th>
		   		 			<th>提交时间</th>
		   		 			<th>所属企业</th>
		   		 			<th>完成时间</th>
							<th class="col-md-2">操作</th>
						</tr>
					</thead>
					<tbody>
					#foreach($item in $pageOrder.result)
		  				<tr>
		  				   
		  					<td>
								<input type="checkbox" name="checkboxes" class="icheck"  value="$!item.id" />
							</td>
						    <td>
						    	$!item.id
						    </td>
						    <td> 
						    #if($!item.state==0) 
						                         未处理 
							    #elseif($!item.quxiao==3)         
							             已取消
							    #else
							                已处理
							     #end
							     
						    </td>
						    <td>$!item.maintennanceItem</td>
						    <td>$!item.userName</td>
						    <td>$!item.realName</td>
						     <td>$!item.ipohe</td>
						    <td>$!item.startTime</td>
						    <td>$!item.submitTime</td>
						    <td>$!item.company</td>
						    <td>$!item.finishTime </td>
						    
						    <td>
						    #if($!item.quxiao==1)
						    
						       	<a a href="#modelContent" class="btn green btn-outline btn-sm ajax-model-get"  data-toggle="modal"  thref="service/serviceManageInfo?id=$!item.id">审核中</a>
						   #else
						   	  <a href="#modelContent" class="btn green btn-outline btn-sm ajax-model-get"  data-toggle="modal"  thref="service/serviceManageInfo?id=$!item.id">编辑</a>						     
						    #end
						
						   	
						   <input type="hidden" class="itemId" value="$!item.id">
						   	
						   	<!-- href="/afterMarketOrder/show?id=$!item.id" -->
						    </td>
			    			<td>
			    				#if($!item.orderState == 'WAIT_AUDIT')
						    	<a class="btn green btn-outline btn-sm ajax-operation" thref="/afterMarketOrder/pass?id=$!item.id" tohref="/afterMarketOrder/list"> 
									<i class="fa fa-check"></i>通过
								</a>
								<a class="btn green btn-outline btn-sm ajax-operation" thref="/afterMarketOrder/refuse?id=$!item.id" tohref="/afterMarketOrder/list"> 
									<i class="fa fa-remove"></i>拒绝
								</a>
								#end
								#if($!item.orderState == 'TREASURER_AUDIT')
									<a class="btn green btn-outline btn-sm ajax-operation" thref="/afterMarketOrder/financePass?id=$!item.id" tohref="/afterMarketOrder/list"> 
										<i class="fa fa-check"></i>通过
									</a>
								#end
								#if($!item.orderState == 'BEING_REFUND')
									<a class="btn green btn-outline btn-sm ajax-model-get" href="#modelContent" thref="/afterMarketOrder/reFund?id=$!item.id" data-toggle="modal"> 
										<i class="fa fa-check"></i>退款
									</a>
								#end
								#if($!item.orderState == 'RETURNING_GOODS')
									<a class="btn green btn-outline btn-sm ajax-operation" thref="/afterMarketOrder/reviceGoods?id=$!item.id" tohref="/afterMarketOrder/list"> 
										<i class="fa fa-check"></i>收货完成
									</a>
								#end
						    </td>		  			
		  				</tr>
					#end
					</tbody>
				</table>
				 
			</div>
			<!-- $!queryString -->
			#set($page=$pageOrder)
			#set($pageUrl="/service/list?$!queryString&pageNo=")
			#parse("_page.htm")
		</div>
		<div id="qrMl" style="display: none;top: 50%; right: 50%; z-index: 100; position: absolute; background-color: #fff; width: 200px;height: 200px;box-shadow: 5px 5px rgba(102,102,102,.1);border: 1px solid #eee;">
		<button type="button" class="close close-click" style="margin: 10px;"></button>
		<img  style="width: 151px;height: 151px;margin-left: 20px">
	  </div>
	<form id="downfile" action="" class="hide" method="POST">
		<input type="hidden" name="pid" id="pid" value="">
		<input type="hidden" name="flag" value="$!flag">
		<button type="submit"></button>
	</form>
    </div>
</div>
<script src="/assets/scripts/views-date.js" type="text/javascript"></script>
<<script type="text/javascript">
ComponentsSelect2.initWithSearch();
$("input[name=code]").focus();
var pageContentBody = $('.page-content .page-content-body');

function getcbvalue(){
	var array = new Array()
	var target= $("input[name='checkboxes']");
	//循环加入数组
	
		$.each(target,function(i,v){
			if(v.checked){
				array.push($(v).val());
			}
		});
	 	return array; 
 }
/*   $(".group-icheck").on('click',function(){
	  var check2=$(this).attr("checked");
	  alert("哈哈"+check2);
	  if($(this).attr('checked')==true){
		  $("input[name='checkboxes']").each(function(){
			   $(this).attr('checked','true')
		  })
		 
	  }else{
		  $("input[name='checkboxes']").each(function(){
			  $(this).removeAttr('checked');
		  })
		
		
	  }
  }) */
/**
 * 批量删除
 */
 $(".delete-tabb").click(function(){
	  var pIdArray= getcbvalue();
	 
	  if(pIdArray.length>0){
 		bootbox.setLocale("zh_CN");
		bootbox.confirm("确定删除这些商品吗？", function(state) {
			if(state){
			   	 $.post("/Mymaintenan/delete",{"pIdArray":pIdArray},function(result){
		        	if(result.code==0){
		        		toastr.success(result.msg);
		       			pageContentBody.load("/service/list");
		       		}else {
		       			toastr.warning(result.msg);
		       		}
			   },"json");
			}
		});
	  }else{
 		 toastr.warning("请选择商品");
 	 }
}) 



  /**
      *
      * excel 导出
      */
     $(".export-tab").click(function(){
    	 var pIdArray= getcbvalue();
    	 if(pIdArray.length>0){
   		    $("#pid").val(pIdArray);
   		    $("#downfile").attr("action","/downloadExcel");
   			$("#downfile").submit();
    	 }else{
    		 toastr.warning("请选择商品");
    	 }
     })
     /*
      *  excel 导出全部
      */
     $(".export-all").click(function(){
	    	$("#pid").val("");
  		    $("#downfile").attr("action","/downloadExcel");
  			$("#downfile").submit();
     })
     
     /**
      *
      * 获得 鼠标点击坐标
      */
     function getMousePos(event) {
            var e = event || window.event;
            var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
            var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
            var x = e.pageX || e.clientX + scrollX;
            var y = e.pageY || e.clientY + scrollY;
            return { 'x': x, 'y': y };
      }
</script>
